In a computer system, an interrupt is a signal generated by a device to indicate the need of attention from a central processing unit (CPU) and its operating system. An interrupt typically causes a CPU to pause and to perform operations requested by the interrupt. An interrupt is a signal raised by a device on a signal line connecting to an interrupt controller. The interrupt controller then sends the interrupt to a CPU. The device may be a physical hardware device or an emulated hardware device. When the CPU receives an interrupt, it saves its state of execution and begins execution of an interrupt handler.
One conventional technique is to send all of the occurrences of an interrupt to a designated CPU in a multi-processor system. This technique has a performance advantage in that the code of the interrupt handler will most likely be found in the CPU cache if the interrupts occur frequently. However, if the designated CPU becomes unavailable, the computer system will experience significant performance degradation.
Another conventional technique is to send the interrupts to any of the CPUs in a multi-processor system. For example, an interrupt can be sent to a CPU chosen at random or based on a round-robin scheme. Without one designated CPU to handle the interrupts, the code of the interrupt handler can bounce from one CPU to another CPU if the interrupts occur frequently. Thus, the computer system will also experience significant performance degradation.
In a virtualized computer system that hosts one or more virtual machines, each virtual machine can have multiple virtual CPUs. When a device generates an interrupt, an interrupt controller, which can be a physical controller or an emulated controller, delivers the interrupt to a virtual CPU in a virtual machine. A computer system may have more virtual CPUs than the physical CPUs in the system. Thus, a virtual CPU will compete for the physical CPU cycles against other virtual CPUs, and may be forced to suspend its operation from time to time to allow other virtual CPUs to run. Moreover, a virtual CPU is similar to a process, which may be temporarily suspended to handle exceptions (e.g., a page fault) or system management functions. The period of suspension can sometimes be very long (e.g., on the order of milliseconds, which is equivalent to millions of physical CPU cycles). When an interrupt is sent to a virtual CPU that is suspended or otherwise not running, the interrupt cannot be serviced until the virtual CPU resumes running. The latency in servicing the interrupt in some computer systems can be so large that these computer systems are rendered unsuitable for running real-time applications.